using System;
using System.Collections.Generic;
using System.Text;

namespace PlayTime
{
    public class ContractBridgeSession:Session
    {
        private static ContractBridgeSession m_cSingleSession = null;
        
        private PartnerShip m_cEastWest;
        private PartnerShip m_cNorthSouth;

        public ContractBridgeSession():base()
        {
            m_cDealerPosition = ChooseDealerPosition();
            m_cEastWest = new PartnerShip(Position.East,Position.West);
            m_cNorthSouth = new PartnerShip(Position.North, Position.South);
        }

        public override Position ChooseDealerPosition()
        {
            Random rndGen = new Random();
            int nRandomDealerPos = rndGen.Next(4);
            return (Position)nRandomDealerPos;
        }        
        public static Session getInstance()
        {
            if (m_cSingleSession == null)
            {
                m_cSingleSession = new ContractBridgeSession();
            }
            return m_cSingleSession;
        }
        public override void Auction()
        {
            m_cHand.Auction();
        }

        public override PartnerShip getPartnerShip(Position Pos)
        {
            if ((Pos == Position.East) || (Pos == Position.West))
            {
                return m_cEastWest;
            }
            else
            {
                return m_cNorthSouth;
            }

        }
    }
}
